const lggo_frag_multisampled = /*wgsl*/ `
struct Input {  
    @location(0) uv : vec2<f32>,
};
struct Output {
    @location(0) color:vec4<f32>,
};
fn combieSample(Texture:texture_multisampled_2d<f32>,uv:vec2<u32>)->vec4<f32>{
    var sampler1= textureLoad(Texture,uv,0);
    var sampler2= textureLoad(Texture,uv,1);
    var sampler3= textureLoad(Texture,uv,2);
    var sampler4= textureLoad(Texture,uv,3);
    var average=(sampler1+sampler2+sampler3+sampler4)/4;
    return average;
 }
 fn getUInt(uv:vec2<f32>)->vec2<u32>{
    return vec2<u32>(u32(uv.x),u32(uv.y));
}
@group(0) @binding(0) var Sampler: sampler;
@group(0) @binding(1) var Texture: texture_multisampled_2d<f32>;
@group(0) @binding(2) var<uniform> lift : vec3<f32>;
@group(0) @binding(3) var<uniform> gain : vec3<f32>;
@group(0) @binding(4) var<uniform> gamma : vec3<f32>;
@group(0) @binding(5) var<uniform> offset : vec3<f32>;
@fragment
fn main(input:Input) -> Output {
    var output:Output;
    var color:vec4<f32>=combieSample(Texture,getUInt(input.uv));
    //进行lift gain gamma offset
    //Lift(提升,暗部调节)
    var oc:vec3<f32>=lift*(color.xyz-1)+1;
    //Gain(增益,高光调节)
    oc=gain*oc;
    //Gamma(伽玛,中间调调节)
    oc=pow(oc, vec3(1.0 / gamma));
    //Offset(灰度偏移
    oc=oc+offset;
    oc=saturate(oc);
    output.color=vec4(oc,color.w);
    return output;
}
`
const lggo_frag = /*wgsl*/ `
struct Input {  
    @location(0) uv : vec2<f32>,
};
struct Output {
    @location(0) color:vec4<f32>,
};
@group(0) @binding(0) var Sampler: sampler;
@group(0) @binding(1) var Texture: texture_2d<f32>;
@group(0) @binding(2) var<uniform> lift : vec3<f32>;
@group(0) @binding(3) var<uniform> gain : vec3<f32>;
@group(0) @binding(4) var<uniform> gamma : vec3<f32>;
@group(0) @binding(5) var<uniform> offset : vec3<f32>;
@fragment
fn main(input:Input) -> Output {
    var output:Output;
    var color:vec4<f32>=textureSample(Texture, Sampler,input.uv);
    //进行lift gain gamma offset
    //Lift(提升,暗部调节)
    var oc:vec3<f32>=lift*(color.xyz-1)+1;
    //Gain(增益,高光调节)
    oc=gain*oc;
    //Gamma(伽玛,中间调调节)
    oc=pow(oc, vec3(1.0 / gamma));
    //Offset(灰度偏移
    oc=oc+offset;
    oc=saturate(oc);
    output.color=vec4(oc,color.w);
    return output;
}
`
export {
    lggo_frag,
    lggo_frag_multisampled
}